-content_for :widget_title do
  %i.grcicon-audit-white
  Audit Cycles
  %span=directive.cycles.count

-content_for :widget_help, 'directive_cycles'

-content_for :widget_id, "audit_cycles_widget"

%ul.tree-structure.simple
  -directive.cycles.order("start_at DESC").each do |cycle|
    %li.item-main
      %a{:href => flow_cycle_path(cycle)}
        .item-title
          .row-fluid
            .span9
              .oneline
                %span.title
                  -if cycle.complete
                    %span.completed
                      =cycle.title
                  -else
                    =cycle.title
                %span.additional-info
                  -if cycle.complete
                    %span.completed
                      Completed
                  -else
                    -if cycle.start_at == Time.zone.now.to_date
                      today
                    -elsif cycle.start_at < Time.zone.now.to_date
                      #{days_ago_in_words cycle.start_at} ago
                    -else
                      starting in: #{days_ago_in_words cycle.start_at}
                    -if cycle.end_at
                      &nbsp;&nbsp;&nbsp;&nbsp;
                      ends on: #{cycle.end_at.strftime("%m/%d/%y")}
            .span2
              .objects-count
                %a{:href => '#'}
                  %i.grcicon-control-color
                  0
